/* 概率和数学期望
    概率dp E(aX+bY) = aE(X)+bE(Y)

* 本题:
    翻到牌的期望张数最小是多少
    f[a][b][c][d][x][y]:从当前状态跳到终点的期望长度
    sum=a+b+c+d+(x!=4)+(y!=4)
    剩余54-sum
    转移方程:下一张牌是
    红桃:(13-a)/(54-sum)*f[a+1][b][c][d][x][y];
    黑桃:(13-b)/(54-sum)*f[a][b+1][c][d][x][y];
    梅花:(13-c)/(54-sum)*f[a][b][c+1][d][x][y];
    方块:(13-d)/(54-sum)*f[a][b][c][d+1][x][y];
    小王:根据放的位置不同判断
        min(x/(54-sum)*f[a][b][c][d][x'][y]) x取0~3
    大王:根据放的位置不同判断
        min(y/(54-sum)*f[a][b][c][d][x][y']) y取0~3

*/
#define DEBUG
#pragma GCC optimize("O1,O2,O3,Ofast")
#pragma GCC optimize("no-stack-protector,unroll-loops,fast-math,inline")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,sse4,sse4.1,sse4.2,ssse3")

#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
// #define int long long
const int N = 14;
const double INF = 1e20;

int A, B, C, D;
double f[N][N][N][N][5][5];

double dp(int a,int b,int c,int d,int x,int y)
{
    if(a>13 || b>13 || c>13 || d>13) return INF;

    double &cur = f[a][b][c][d][x][y];
    if(cur >= 0) return cur;

    //4个牌堆有的数量
    int as = a + (x == 0) + (y == 0);
    int bs = b + (x == 1) + (y == 1);
    int cs = c + (x == 2) + (y == 2);
    int ds = d + (x == 3) + (y == 3);

    if(as >= A && bs >= B && cs >= C && ds >= D) return cur=0;//当前已满足，不再需要翻牌

    int sum = a+b+c+d+(x!=4)+(y!=4);
    sum = 54-sum; //优化，只需要剩余牌数
    if(sum <= 0) return cur = INF;//非法解

    cur = 1; //初始化, 当前一定要翻一张
    //四种花色枚举
    if(a < 13) cur += (13.0-a)/sum*dp(a+1, b, c, d, x, y);
    if(b < 13) cur += (13.0-b)/sum*dp(a, b+1, c, d, x, y);
    if(c < 13) cur += (13.0-c)/sum*dp(a, b, c+1, d, x, y);
    if(d < 13) cur += (13.0-d)/sum*dp(a, b, c, d+1, x, y);
    //小王
    if(x == 4) //没用过
    {
        double t = INF;
        for(int i = 0; i < 4; i++) t = min(t, 1.0/sum*dp(a, b, c, d, i, y));//求期望最小
        cur += t;
    }
    //大王
    if(y == 4) //没用过
    {
        double t = INF;
        for(int i = 0; i < 4; i++) t = min(t, 1.0/sum*dp(a, b, c, d, x, i));//求期望最小
        cur += t;
    }
    return cur;
}

signed main()
{
    #ifdef DEBUG
        freopen("./in.txt", "r", stdin);
    #else
        ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #endif

    cin >> A >> B >> C >> D;
    memset(f, -1, sizeof f);

    double ans = dp(0, 0, 0, 0, 4, 4);
    if(ans > INF/2) ans = -1;

    printf("%.3lf\n", ans);
    return 0;
}